package com.nkzy.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private int code;
    private String msg;
    private Object data;
    //类中static表示静态的方法，不需要创建对象，直接调用类名+点
    //成功，有数据
    public static Result ok(Object data) {
        return new Result(200, "success", data);
    }
    //失败
    public static Result msg(String msg) {
        return new Result(400, msg, null);
    }
    //成功，没有数据
    public static Result ok() {
        return new Result(200, "success", null);
    }
}
